﻿using UnityEngine;
using System.Collections;

public class RequestFriendCell : MonoBehaviour {

	const int ACCEPT_REQUEST = 1;
	const int REJECT_REQUEST = 2;

	[HideInInspector] public int indexPath;

	public UILabel nameLabel;
	public UILabel levelLabel;
	public UILabel lastAccessLabel;
	public UILabel gradeLabel;
	public UILabel allianceNameLabel;

	public UIToggle trademarkToggle;

	public GameObject allianceGroup;
	public GameObject allianceNoneGroup;

	public GameObject cancelButton;
	public GameObject acceptButton;
	public GameObject rejectButton;

	void Awake ()
	{
		allianceGroup.SetActive(false);
		allianceNoneGroup.SetActive(true);
	}

	void Start ()
	{

	}

	public void OnClick_CancelRequest()
	{
		Debug.Log ("OnClick_CancelRequest : " + indexPath);
		this.GetComponent<UIDragScrollView>().scrollView.GetComponent<RequestFriendScrollView>().sceneManager.CancelRequestProcess(indexPath);
	}

	public void OnClick_AcceptRequest()
	{
		Debug.Log ("OnClick_AcceptRequest : " + indexPath);
		this.GetComponent<UIDragScrollView>().scrollView.GetComponent<RequestFriendScrollView>().sceneManager.AcceptRequestProcess(indexPath, ACCEPT_REQUEST);
	}

	public void OnClick_RejectRequest()
	{
		Debug.Log ("OnClick_RejectRequest : " + indexPath);
		this.GetComponent<UIDragScrollView>().scrollView.GetComponent<RequestFriendScrollView>().sceneManager.AcceptRequestProcess(indexPath, REJECT_REQUEST);
	}

}
